package org.electrode.system;

import org.electrode.base.XboxJoystick;
import org.electrode.common.RobotSystem;

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.networktables.NetworkTable;
import edu.wpi.first.wpilibj.tables.ITable;

public class Climber extends RobotSystem {
	private final XboxJoystick control;
	private Victor left;
	private Victor right;
	private DigitalInput upper;
	private DigitalInput lower;

	public Climber(XboxJoystick xbox) {
		this.control = xbox;
	}

	public String getName() {
		return "Climber";
	}

	public void init() {
		left = new Victor(9);
		right = new Victor(10);
		upper = new DigitalInput(7);
		lower = new DigitalInput(8);

		ITable table = NetworkTable.getTable(getName());
		left.initTable(table.getSubTable("Left"));
		right.initTable(table.getSubTable("Right"));
		upper.initTable(table.getSubTable("Upper"));
		lower.initTable(table.getSubTable("Lower"));
	}

	public void disable() {
	}

	private void updateTables() {
		left.updateTable();
		right.updateTable();
		upper.updateTable();
		lower.updateTable();
	}

	public void periodicTeleop() {
		updateTables();
		// TODO
	}

	public void periodicTest() {
		updateTables();
	}

}
